home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Python 1.3.3 / stdwin / Tools / strdup.c < prev   
C/C++ Source or Header  |  1995-12-21  |  196b  |  14 lines

  1. #include "tools.h"
  2.  
  3. char *
  4. strdup(str)
  5.     const char *str;
  6. {
  7.     if (str != NULL) {
  8.         register char *copy = malloc(strlen(str) + 1);
  9.         if (copy != NULL)
  10.             return strcpy(copy, str);
  11.     }
  12.     return NULL;
  13. }
  14.